import Mock from 'mockjs'
// npm install mockjs -D  安装开发依赖
import { getUserInfo } from './response/user'
const Random = Mock.Random

// 定义模拟数据
Mock.mock('http://www.baidu.com/api/getUserInfo', 'post', getUserInfo)
// /\/getUserInfo/ 如果使用正则，则不用使用全部接口地址
// Mock.mock('http://www.baidu.com/api/getUserInfo', 'post', { name: 'hahah' })

Mock.setup({
  timeout: 0
})

Random.extend({
  fruit () {
    const fruit = ['apple', 'peach', 'lemon']
    return this.pick(fruit)
  }
})

export default Mock
